﻿using A.M.ETO;
using A.M.Storage.Application;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Q.M.Sell.Application.IServices;
using Q.M.Sell.Doamin.Entity;
using Q.M.Sell.Infrastruecure.IRepository;
using Q.M.Sell.Infrastruecure.Repository;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Q.M.Sell.Application.Services
{
    public class Sales_productServices : BaseServices<sales_product, string>, ISales_productServices
    {
        private readonly ISales_productRepository sales_ProductRepository;
        public Sales_productServices(ISales_productRepository sales_ProductRepository) : base(sales_ProductRepository)
        {
            this.sales_ProductRepository = sales_ProductRepository;
        }
        /// <summary>
        /// 反填销售订单下的产品
        /// </summary>
        /// <param name="salesid"></param>
        /// <returns></returns>
        public async Task<List<sales_product>> FindproductInfo(string? salesid)
        {
            Expression<Func<sales_product, bool>> wherexp = i => true;
            if (!string.IsNullOrEmpty(salesid))
            {
                wherexp = i => i.sales_number == salesid;
            }
            var sales = sales_ProductRepository.GetShowInforOrder(wherexp, x=>x.productid);
            return sales;
        }

    }
}
